package com.ruoyi.project.system.controller;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.SysFollow;
import com.ruoyi.project.system.service.ISysFollowService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 * 
 * @author jjp
 * @date 2020-07-15
 */
@RestController
@Api("【请填写功能名称】")
@RequestMapping("/system/follow")
public class SysFollowController extends BaseController
{
    @Autowired
    private ISysFollowService sysFollowService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:follow:list')")
    @ApiOperation("查询【请填写功能名称】列表")
    @GetMapping("/list")
    public TableDataInfo list(SysFollow sysFollow)
    {
        startPage();
        List<SysFollow> list = sysFollowService.selectSysFollowList(sysFollow);
        return getDataTable(list);
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:follow:query')")
    @ApiOperation("获取【请填写功能名称】详细信息")
    @GetMapping(value = "/{followId}")
    public AjaxResult getInfo(@PathVariable("followId") Long followId)
    {
        return AjaxResult.success(sysFollowService.selectSysFollowById(followId));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:follow:add')")
    @ApiOperation("新增【请填写功能名称】")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysFollow sysFollow)
    {
        return toAjax(sysFollowService.insertSysFollow(sysFollow));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:follow:edit')")
    @ApiOperation("修改【请填写功能名称】")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysFollow sysFollow)
    {
        return toAjax(sysFollowService.updateSysFollow(sysFollow));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:follow:remove')")
    @ApiOperation("删除【请填写功能名称】")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{followIds}")
    public AjaxResult remove(@PathVariable Long[] followIds)
    {
        return toAjax(sysFollowService.deleteSysFollowByIds(followIds));
    }
}
